﻿@model PagedResultDto<Blog>
@{
    ViewData["Title"] = "List";
    Layout = "_BlogLayout";
}
<div class="blog-posts blog-common row">
    <!-- articles left bar -->
    <div class="col-md-8">
        <!-- Post-1 @@Html.Raw("<span>Hello World</span>")-->
        @foreach (var article in Model.Items)
        {
            <article class="hentry post type-post fine">
                <header class="entry-head">
                    <h2 class="title"><a asp-controller="Blog" asp-action="Detail" asp-route-id="@article.Id" rel="bookmark">@article.Title</a></h2>
                    <div class="meta">
                        <p>
                            Posted by <span class="vcard author">@article.Editer</span> in
                            <span class="category">@article.Catalog</span> on
                            <time datetime="2014-04-28" class="pub-date">@article.CreatedOn.ToLocalString()</time>
                        </p>
                    </div>
                </header>
                <div class="entry-content">
                    <figure class="featured-image">
                        <img src="@article.ImageUrl" alt="image">
                    </figure>
                    <div class="content">
                        <p>@article.Desc</p>
                        <a asp-controller="Blog" asp-action="Detail" asp-route-id="@article.Id" class="more-btn">Read More</a>
                    </div>
                </div>
            </article>
        }
        @if (Model.PageCount > 1)
        {
            <!-- blog pagination -->
            <div class="blog-pagination">
                <div class="prev-btn text-uppercase">
                    <a href="#"><i class="elegant-eleganticons-2"></i>Older</a>
                </div>
                <!-- pagination -->
                <ul class="pagination list-unstyled">
                    @for (var pageIndex = 0; pageIndex < Model.PageCount; pageIndex++)
                    {
                        <li class="@(Model.PageIndex==pageIndex?"active":"")">
                            <a asp-controller="Blog" asp-action="Index" asp-route-catalog="@ViewData["Catalog"]" asp-route-tag="@ViewData["Tag"]" asp-route-PageIndex="@pageIndex">@(pageIndex + 1)</a>
                        </li>
                    }
                </ul>
                <!-- #end pagination -->
                <div class="next-btn text-uppercase">
                    <a href="#">Newer<i class="elegant-eleganticons-3"></i></a>
                </div>
            </div>
        }
    </div>

    @{await Html.RenderPartialAsync("Sidebar");}
</div> <!-- .row, .blog-posts -->